<div data-extend-template="layouts/partials/table.html">
  <div data-block="search-filter">
    <select class="form-control" ng-model="contentView" ng-change="contentViewSelected(contentView)" ng-options="contentView.name for (id, contentView) in contentViews"></select>
    <select class="form-control" ng-model="repository" ng-change="repositorySelected(repository)" ng-options="repository.name for (id, repository) in repositories"></select>
  </div>

  <span data-block="no-rows-message" ng-bind="getNoRowsMessage()"></span>
  <span data-block="no-search-results-message" ng-bind="getZeroResultsMessage()"></span>

  <table data-block="table" class="table table-striped table-bordered">
    <thead>
      <tr bst-table-head>
        <th bst-table-column="errata_id" sortable >{{ "Errata ID" | translate }}</th>
        <th bst-table-column="title">{{ "Title" | translate }}</th>
        <th bst-table-column="type">{{ "Type" | translate }}</th>
        <th bst-table-column="numberOfContentHosts">{{ "Applicable Content Hosts" | translate }}</th>
        <th bst-table-column="updated" sortable>{{ "Updated" | translate }}</th>
      </tr>
    </thead>

    <tbody>
      <tr bst-table-row ng-repeat="errata in table.rows">
        <td bst-table-cell>
          <a ui-sref="erratum.info({errataId: errata.id})">
            {{ errata.errata_id }}
          </a>
        </td>
        <td bst-table-cell>
          {{ errata.title }}
        </td>
        <td bst-table-cell>
            <span ng-show="errata.type == 'security'">
              <i class="fa fa-warning inline-icon" title="{{ 'Security' | translate }}"></i>
            </span>

            <span ng-show="errata.type == 'bugfix' || errata.type == 'recommended'">
              <i class="fa fa-bug inline-icon" title="{{ 'Bug Fix' | translate }}"></i>
            </span>

            <span ng-show="errata.type == 'enhancement' || errata.type = 'optional'">
              <i class="fa fa-plus-square inline-icon" title="{{ 'Enhancement' | translate }}"></i>
            </span>

          {{ errata.type | errataType}}
          <span ng-show="errata.severity">- {{ errata.severity | errataSeverity}}</span>
        </td>
        <td bst-table-cell class="number-cell">{{ errata.hosts_available_count || 0 }}</td>

        <td bst-table-cell><date date="errata.updated" /></td>
      </tr>
    </tbody>
  </table>
</div>
